<?php
$this->breadcrumbs = array(
    'Avatar',
);
?>
<?php if ($model->updated_on === null)
        echo "ban phai cap nhat thong tin truoc khi thay doi avatar.";
        else 
        {?>

<div class="main-box border-line">
    <div class="main-title">
        <span>Change Your Avatar</span>
    </div>
    <div class="main-content">
<?php 
$this->beginWidget('CActiveForm', array(
    'id'=>'user-profiles-form',
    'enableAjaxValidation'=>true,
    'htmlOptions'=>array (
        'enctype'=>'multipart/form-data',
    ),
));
?>
    </div>
</div>
<?php 
if ($model->id === Yii::app()->user->id)
{
    echo Chtml::activeFileField($model,'avatar');
    echo CHtml::error ($model,'avatar');
    echo Chtml::submitButton ('UpFile');
}
$this->endWidget();
?>

            <li>
                <img width='250' height='175' src ="<?php if ($model!=null AND $model->avatar!=null) { echo Yii::app()->request->baseUrl;?>/data/<?php echo $model->avatar;} else echo Yii::app()->request->baseUrl."/images/noavatar.gif";?>" />
            </li>
     
<?php }?>